// Copyright 2008 Senary
// See credits.txt for details.

// This file is part of Omega VII.

// Omega VII is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.

// Omega VII is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.

// You should have received a copy of the GNU General Public License
// along with Omega VII.  If not, see <http://www.gnu.org/licenses/>.

#pragma once

#include <windows.h> //required by adll.h
#include <string>
#include "sdk_engine/adll.h"

class Vector;

class Angle
{
public:
	// Euler angles, in radians
	double pan, tilt, roll;

	// Constructors
	Angle() : pan(0.0f), tilt(0.0f), roll(0.0f) {}
	Angle(double pan, double tilt, double roll)
		: pan(pan), tilt(tilt), roll(roll) {}
	Angle(Angle const& rhs)
		: pan(rhs.pan), tilt(rhs.tilt), roll(rhs.roll) {}

	// Creates an angle from the direction a vector points to
	// equivalent to vec_for_angle() in GameStudio
	Angle(Vector const& vec);

	// Creates an angle from the GameStudio equivalent
	// Param rhs: the address of an ANGLE struct or, equivalently, the
	//            address of the pan attribute, converted to ANGLE*
	Angle(ANGLE const* rhs);

	// Destructor
	~Angle(void) {}

	///Assign operator
	Angle& operator=(Angle const& rhs);

	// Converts an Angle back onto the supplied GameStudio ANGLE pointer
	// Param rhs: the address of an ANGLE struct or, equivalently, the
	//            address of the pan attribute, converted to ANGLE*
	void toGamestudio(ANGLE * angle);

	/// Return a string representation of the vector
	std::string toString() const;
};

///Equals
bool operator==(Angle const& a, Angle const& b);

///Not equal
bool operator!=(Angle const& a, Angle const& b);

///Print an angle to  a stream
std::ostream& operator<<(std::ostream & os, Angle const& rhs);